import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { TQixingshenhunConfig } from "../../../Message/Db/Tables/TQixingshenhunConfig";
type int = number;
//class QiXingShenHunConfig
    
    export  class QiXingShenHunConfig
    {
        constructor()
        {
            
            var loc1=ConfigManager.instance.getJSONByFileName("t_qixingshenhun_config.json");
            this._dic = new Map<any, any> /* flash.utils.Dictionary */();
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TQixingshenhunConfig();
                loc1.name = loc2.name;
                loc1.level = loc2.level;
                loc1.star = loc2.star;
                loc1.experience = loc2.experience;
                loc1.attack = loc2.attack;
                loc1.crit = loc2.crit;
                loc1.physicalDefense = loc2.physicalDefense;
                loc1.magicDefense = loc2.magicDefense;
                loc1.life = loc2.life;
                loc1.hit = loc2.hit;
                loc1.jouk = loc2.jouk;
                loc1.pass = loc2.pass;
                loc1.toughness = loc2.toughness;
                loc1.relief = loc2.relief;
                loc1.modifiedExp = loc2.modifiedExp;
                this._dic[loc1.star + "_" + loc1.level] = loc1;
            }
            return;
        }

        public getExperience(arg1: int, arg2: int): int
        {
            var loc1=0;
            var loc2;
            if (loc2 = this._dic[arg1 + "_" + arg2] as TQixingshenhunConfig) 
            {
                loc1 = loc2.modifiedExp;
            }
            return loc1;
        }

        public getName(arg1: int): string
        {
            var loc1="";
            var loc2=this._dic[arg1 + "_" + 1] as TQixingshenhunConfig;
            if (loc2) 
            {
                loc1 = loc2.name;
            }
            return loc1;
        }

        public getAttribute(arg1: int, arg2: int): string
        {
            var loc1="";
            var loc2;
            if (loc2 = this._dic[arg1 + "_" + arg2] as TQixingshenhunConfig) 
            {
                if (loc2.life > 0) 
                {
                    loc1 = loc1 + ("#1," + loc2.life);
                }
                if (loc2.attack > 0) 
                {
                    loc1 = loc1 + ("#8," + loc2.attack);
                    loc1 = loc1 + ("#9," + loc2.attack);
                }
                if (loc2.physicalDefense > 0) 
                {
                    loc1 = loc1 + ("#10," + loc2.physicalDefense);
                }
                if (loc2.magicDefense > 0) 
                {
                    loc1 = loc1 + ("#11," + loc2.magicDefense);
                }
                if (loc2.crit > 0) 
                {
                    loc1 = loc1 + ("#12," + loc2.crit);
                    loc1 = loc1 + ("#13," + loc2.crit);
                }
                if (loc2.hit > 0) 
                {
                    loc1 = loc1 + ("#14," + loc2.hit);
                }
                if (loc2.jouk > 0) 
                {
                    loc1 = loc1 + ("#15," + loc2.jouk);
                }
                if (loc2.pass > 0) 
                {
                    loc1 = loc1 + ("#16," + loc2.pass);
                }
                if (loc2.toughness > 0) 
                {
                    loc1 = loc1 + ("#19," + loc2.toughness);
                }
                if (loc2.relief > 0) 
                {
                    loc1 = loc1 + ("#20," + loc2.relief);
                }
            }
            if (loc1.length > 0) 
            {
                loc1 = loc1.substring(1);
            }
            return loc1;
        }

        public static get instance(): QiXingShenHunConfig
        {
            if (QiXingShenHunConfig._instance == null) 
            {
                QiXingShenHunConfig._instance = new QiXingShenHunConfig();
            }
            return QiXingShenHunConfig._instance;
        }

        /* internal */ /* var */_dic: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: QiXingShenHunConfig;
    }
